import request from '@/utils/request'


//获取文章详情的接口
export const getArticle = articleId => request({
    method: 'GET',
    url: `/v1_0/articles/${articleId}`,
})



//关注用户的接口
export const addFollow = target => request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
        target
    }
})


//取消关注用户的接口
export const deleteFollow = target => request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${target}`,
})

//收藏文章的接口
export const addCollect = target => request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
        target
    }
})

//取消收藏文章的接口
export const deleteCollect = target => request({
    method: 'DELETE',
    url: `v1_0/article/collections/${target}`,
})



//对文章点赞的接口
export const addGood = target => request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
        target
    }
})



//取消对文章点赞的接口
export const deleteGood = target => request({
    method: 'DELETE',
    url: `/v1_0/article/likings/${target}`,
})


//获取评论或评论回复的接口
export const getComment = params => request({
    method: 'GET',
    url: '/v1_0/comments',
    params
})


//对评论或评论回复点赞的接口
export const addCommentLike = target => request({
    method: 'POST',
    url: '/v1_0/comment/likings',
    data: {
        target
    }
})


//取消对评论或评论回复点赞的接口
export const deleteCommentLike = target => request({
    method: 'DELETE',
    url: `/v1_0/comment/likings/${target}`,
})


//对文章或者评论进行评论的接口
export const addComment = data => request({
    method: 'POST',
    url: '/v1_0/comments',
    data
})